package com.yanyq.config;

import com.yanyq.service.HelloService;
import com.yanyq.service.impl.HelloServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * @author
 * @date 2021-09-15 20:30:23
 */
public class HelloAutoConfiguration {
    //当容器中没有 HelloService 时生效
    @ConditionalOnMissingBean(HelloService.class)
    @Bean
    public HelloService helloService() {
        HelloService helloService = new HelloServiceImpl();
        return helloService;
    }
}
